package com.hdit.rpc
{
	import mx.rpc.AsyncResponder;
	import mx.rpc.AsyncToken;
	import mx.rpc.Responder;
	
	/**
	 * 实现异步响应抽象类
	 * @author kaka
	 */
	public class AsyncResponder extends AbstractResponder
	{
		private var token:AsyncToken;
		/**
		 * 调用父类构造函数传入默认处理函数,保存远程请求令牌AsyncToken添加请求成功或失败处理代理
		 * @param token 一个远程调用令牌
		 * @param defaultHandler 默认处理函数
		 */
		public function AsyncResponder(token:AsyncToken,defaultHandler:Function=null)
		{
			super(defaultHandler);
			this.token=token;
			token.addResponder(new mx.rpc.AsyncResponder(resultHandler,faultHandler));
		}
		/**
		 * 
		 * @param data ResultEvent类型
		 */
		private function resultHandler(data:Object,token:Object=null):void
		{
			super.notifyResultListener(data);
		}
		private function faultHandler(data:Object,token:Object=null):void
		{
			super.notifyFaultListener(data);
		}
	}
	
}